<% content_for :page_head do %>
  <h1><%= link_to @req.project.key, project_path(@req.project) %><%="-Req-" + @req.reqid.to_s %></h1>
<% end %>

<% content_for :other_index do %>
  <span class="other_indexes">
    <%= link_to "编辑", edit_requirement_url %>
  </span>
<% end %>

<div id="issue_info">
<table style="text-align:left">
  <tbody>
    <tr><td width="20%" valign="top">优先级:</td><td width="80%" valign="top"><%= @req.priority %></td></tr>
    <tr class="odd"><td width="20%" valign="top">应完成时间:</td><td width="80%" valign="top"><%= @req.should_be_finish_time %></td></tr>
    <tr><td width="20%" valign="top">实际完成时间:</td><td width="80%" valign="top"><%= @req.actually_finish_time %></td></tr>
    <tr class="odd"><td width="20%" valign="top">工程师:</td><td valign="top" id=<%= "b_" + @req.id.to_s %> onclick="if($(this).firstChild.tagName != 'SELECT'){new Ajax.Updater('<%= "b_" + @req.id.to_s %>', '<%= "/requirements/" + @req.id.to_s + "/change_developer" %>', {method: 'get'});}"><%= @req.user.name %></td></tr>
    <tr><td width="20%" valign="top">需求来源:</td><td valign="top"><%= @req.from %></td></tr>
    <tr class="odd"><td width="20%" valign="top">标题:</td><td valign="top"><%= @req.title %></td></tr>
    <tr><td width="20%" valign="top">描述:</td><td valign="top"><%= @req.description %></td></tr>
  </tbody>
</table>
</div>

<% content_for :right_side do %>
  <p style="color:#999999;">目前该项目的状态为： <%= trans_current_state_to_chs @req.project.state %></p>
  <p style="color:#999999;">目前该Issue的状态为： <%= trans_issue_state_to_chs @req.state %></p>
  <h2>对该需求的状态进行变更</h2>
  <% if @req.state == "assigned" || @req.state == "reopen" %>
    <div id="the_other_control">
      <%= link_to image_tag("add_icon.gif"), {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "working"}, :class=>"image"%>
      <%= link_to "解决问题", {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "working"}, :class=>"grey" %>
    </div>
  <% end %>
  <% if @req.state == "resolved" || @req.state == "finished" || @req.state == "suspend" %>
    <div id="the_other_control">
      <%= link_to image_tag("add_icon.gif"), {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "rework"}, :class=>"image"%>
      <%= link_to "重新开启", {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "rework"}, :class=>"grey" %>
    </div>
  <% end %>
  <% if @req.state == "reopen" || @req.state == "submitted" %>
    <div id="the_other_control">
      <%= link_to image_tag("download.gif"), {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "hang_up"}, :class=>"image"%>
      <%= link_to "挂起", {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "hang_up"}, :class=>"grey" %>
    </div>
  <% end %>
  <% if @req.state == "resolved" %>
    <div id="the_other_control">
      <%= link_to image_tag("add_icon.gif"), {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "working"}, :class=>"image"%>
      <%= link_to "关闭问题", {:controller => "requirements", :action => "change_state", :id => @req, :op_code => "working"}, :class=>"grey" %>
    </div>
  <% end %>
<% end %>